﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;
using Antu.WebControls;
using Antu.Core.Components;
using Antu.Core.Services;
using System.Web.UI.WebControls;
using EluZSProvider;
using System.Web;
using System.Data;
using Antu.Core.DataAccess;

namespace WebSys.UI.Control.ZhengShou
{
    public class GetExceptionIDControl : MPBasicTemplate
    {
        EluZSDataProvider _EluZSDataProvider = (EluZSDataProvider)ProviderService.ProviderServiceMange.GetProvider("EluZSProvider");
        TextBox txt消除异常, txtID;
        public string userid = string.Empty;
        protected override void OnLoad(EventArgs e)
        {
            if (HttpContext.Current.Session["UserID"] == null)
            {
                Antu.Utilities.UtilitiesPage.AlertDialogClear("登录超时，请重新登录！", "window.parent.location.href('../login.aspx');");
            }
            else
            {
                userid = HttpContext.Current.Session["UserID"].ToString();
            }
            base.OnLoad(e);
            InitControl();
            Button btn_Insert = (Button)FindControl("btn_Insert");
            btn_Insert.Click += new EventHandler(btn_Insert_Click);
            string strid = base.Page.Request["ID"];
            if (!base.Page.IsPostBack)
            {
                if (!string.IsNullOrEmpty(strid))
                {
                    txtID.Text = strid;
                    EluZSProvider.Hbhxy hbhxy = _EluZSDataProvider.GetHbhxy(strid);
                    txt消除异常.Text = hbhxy.消除异常;
                }
            }
        }
        protected void InitControl()
        {
            txt消除异常 = (TextBox)FindControl("txt消除异常");
            txtID = (TextBox)FindControl("txtID");
        }
        protected void btn_Insert_Click(object sender, EventArgs e)
        {
            string strid = base.Page.Request["ID"];
            EluZSProvider.Hbhxy hbhxy = _EluZSDataProvider.GetHbhxy(strid);
            hbhxy.消除异常 = txt消除异常.Text;

            bool save = _EluZSDataProvider.SaveHbhxy(strid, hbhxy);
            if (save) { Page.ClientScript.RegisterStartupScript(this.GetType(), "setParentValue", "<script>setParentValue();</script>"); }
        }
    }
}


